<layout name='layout' />

<div class="admin-main">

	<blockquote class="layui-elem-quote">
		<a href="<{:U('Article/add')}>" class="layui-btn layui-btn-small">
			<i class="layui-icon">&#xe608;</i> 添加
		</a>

		<button class="layui-btn layui-btn-small" id="moveBtn">
			<i class="fa fa-exchange"></i> 批量移动
		</button>
		
		<a href="<{:U('Article/trash')}>" class="layui-btn layui-btn-small">
			<i class="fa fa-trash"></i> 回收站
		</a>

		<button class="layui-btn layui-btn-small" onclick="window.location.reload();">
			<i class="fa fa-refresh"></i> 刷新
		</button>

		<button class="layui-btn layui-btn-small layui-btn-danger" id="delBtn">
			<i class="fa fa-close"></i> 删除
		</button>

		<div class="search">
			<form class="layui-form" method="post" action="<{:U('Article/index')}>">
			<div class="layui-input-inline">
			<select name="path" id="path">
				<option value="0">全部</option>
				<volist name="cate" id="vo">
				<option value='<{$vo['path']}>'><php>
		            for($i=0; $i<$vo['count']*2; $i++){
		               echo '&nbsp;&nbsp;';            
		            }
		        </php><{$vo['name']}></option>
				</volist>
			</select>
			</div>
			<div class="layui-input-inline">
			<input type="text" name="keyword" class="layui-input layui-btn-small">
			</div>
			<button type="submit" class="layui-btn" lay-submit=""><i class="layui-icon">&#xe615;</i> 搜索</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</form>
		</div>
	</blockquote>

	<fieldset class="layui-elem-field">
		<legend>数据列表</legend>
		<div class="layui-field-box">
			<form id="ajaxForm" method="post" action="<{:U('Article/del')}>">
			<table class="site-table table-hover">
				<thead>
					<tr>
						<th><input type="checkbox" id="selected-all"></th>								
						<th>标题</th>
						<th>所属分类</th>
						<th>作者</th>
						<th>创建时间</th>
						<th>浏览量</th>
						<th>状态</th>
						<th>排序值</th>
						<th>属性</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<volist name="list" id="vo">
					<tr>
						<td><input type="checkbox" name="selectedids[]" value="<{$vo.id}>"></td>
						<td><a href="<{:U('Article/edit' , array('id'=>$vo['id']))}>" class="preview" alt="<{$vo.picname}>" title="<{$vo.title}>"><{$vo.title}></a></td>
						<td><a href="<{:U('Article/index',array('path'=>$vo['path']))}>"><{$cateArr[$vo['cid']]}></a></td>
						<td><{$vo.editer}></td>
						<td><{$vo.createTime|date='Y-m-d H:i:s',###}></td>
						<td><{$vo.hit}></td>
						<td><eq name="vo.status" value="1">正常<else/><font color='red'>草稿</font></eq></td>
						<td><{$vo.sort}></td>	
						<td>
							<eq name="vo.flash" value="1"><font color='green'>幻</font></eq>
							<eq name="vo.comm" value="1"><font color='blue'>荐</font></eq>
							<eq name="vo.top" value="1"><font color='0099FF'>顶</font></eq>
							<eq name="vo.bold" value="1"><font color='black'>粗</font></eq>
							<eq name="vo.red" value="1"><font color='red'>红</font></eq>
						</td>	
						<td>
							<a href="<{:U('Article/edit' , array('id'=>$vo['id']))}>" class="layui-btn layui-btn-mini">编辑</a>
						</td>
					</tr>	
					</volist>						
				</tbody>
			</table>
			<input type="hidden" name="mpath" id="mpath">
			</form>
		</div>
	</fieldset>
	<div class="admin-table-page">
		<div id="page" class="page"><{$page}></div>
	</div>
</div>

<script type="text/javascript">
$("#path").val("<{$path}>");

$("#moveBtn").click(function(){
	_html = '<div style="padding:20px;">';
	_html += '<select name="pathSel" id="pathSel" style="padding:4px 0" onchange="setPath()">';
	<volist name="cate" id="vo">
	_html += '<option value="<{$vo['id']}>,<{$vo['path']}>"><php>
		            for($i=0; $i<$vo['count']*2; $i++){
		               echo '&nbsp;&nbsp;';            
		            }
		        </php><{$vo['name']}></option>';
	</volist>
	_html += '</select>';
	_html += '</div>';
	layer.open({
		type: 1,
		title:'批量移动',
		area: ['420px', '200px'], //宽高
		btn: ['确定'],
		content: _html,
		yes:function(index){			 
			layer.close(index);
			$('#ajaxForm').attr('action', '<{:U('Article/move')}>');
			$('#ajaxForm').submit();
		}
	});
});

function setPath(){
	$("#mpath").val($("#pathSel").val());
}
</script>
		
